<?php
/**
 * 
 * Template for permission editing
 * 
 * @category Abovo
 * 
 * @package Abovo_App_System
 * 
 * @subpackage Abovo_App_System_Users
 * 
 * @license http://opensource.org/licenses/gpl-license.php GPL
 * 
 * @author Antti Holvikari <anttih@gmail.com>
 * 
 */
?>

<div class="yui-g">
<div class="yui-u">
        <h2><?php echo $this->getText('TEXT_CONTACT_INFO') ?></h2>
    <table class="list">
        <tr>
            <td><?php echo $this->avatar($this->user->handle) ?></td>
            <td><b><?php echo $this->escape($this->user->firstname  . ' ' . $this->user->lastname) ?></b></td>
        </tr>
        <tr>
            <th><?php echo Solar::$locale->fetch('Abovo_Model_Company', 'LABEL_NAME') ?></th>
            <td><a href="<?php echo $this->action('crm/companies/show/' . $this->user->companies_id) ?>">
                <?php echo $this->escape($this->user->company) ?></a>
            </td>
        </tr>
        <tr>
            <th><?php echo Solar::$locale->fetch('Abovo_Model_Contacts', 'LABEL_EMAIL') ?></th>
            <td><a href="mailto: <?php echo $this->escape($this->user->email) ?>"><?php echo $this->escape($this->user->email) ?></a></td>
        </tr>
        <tr>
            <th><?php echo Solar::$locale->fetch('Abovo_Model_Contacts', 'LABEL_TEL') ?></th>
            <td><?php echo $this->escape($this->user->tel) ?></td>
        </tr>
        <tr>
            <th><?php echo Solar::$locale->fetch('Abovo_Model_Contacts', 'LABEL_ADR') ?></th>
            <td><?php echo $this->escape($this->user->adr) ?><br />
            <?php echo $this->escape($this->user->postal_code) ?>, <?php echo $this->escape($this->user->city) ?><br />
            <?php echo $this->getTextClass('Lux_Intl', 'COUNTRY_' . $this->user->country) ?></td>
        </tr>
    </table>

</div>

<div class="yui-u first">
    <h2><?php echo $this->getText('TEXT_PERMISSIONS') ?></h2>
    <form method="POST" action="<?php echo $this->action('') ?>">
    <table class="list">
        <?php foreach ($this->perms as $module => $data): ?>
            <tr>
                <td><b><?php echo $this->escape($data['name']) ?></b>
                 - <i><?php echo $this->escape($data['descr']) ?></i></td>
            </tr>
            <?php foreach ($data['apps'] as $app => $app_info): ?>
                <tr>
                    <td style="padding-left: 20px;">
                    <b><?php echo $this->escape($app_info['name']) ?></b>
                     - <i><?php echo $this->escape($app_info['descr']) ?></i></td>
                </tr>
                <?php foreach ($app_info['actions'] as $action => $action_info): ?>
                    <tr>
                        <td style="padding-left: 20px;">
                        <?php echo $this->formCheckbox(array(
                            'name'  => "apps[$app][$action]",
                            'value' => $action_info['value'],
                        )) ?>
                        <?php echo $this->escape($action_info['name']) ?></td>
                    </tr>
                <?php endforeach; ?>
            <?php endforeach; ?>
        <?php endforeach; ?>
    </table>
    <?php echo $this->formSubmit(array(
        'name' => 'process',
        'value' => $this->getText('PROCESS_SAVE'),
    )) ?>
    </form>
</div>
</div>
